home *** CD-ROM | disk | FTP | other *** search
- REM Titlebar
-
- ' declare four Windows API calls (all from USER module) that we'll use
- Declare Sub GetWindowText Lib "user" \
- (hWnd As Integer, lpString$, nMaxCount As Integer)
- Declare Sub SetWindowText Lib "user" \
- (hWnd As Integer, lpString$)
- Declare Sub SendMessage Lib "user" \
- (hWnd As Integer, wMsg As Integer, wParam As Integer, lParam$)
- Declare Function GetActiveWindow Lib "user"() As Integer
-
- Sub MAIN
- hwnd = GetActiveWindow ' find WinWord's window handle
- save$ = String$(128, " ") ' allocate a string to hold title bar
- GetWindowText hwnd, save$, 128 ' get the title bar into the string
- Print save$
- SetWindowText hwnd, "this is a test" ' change the title bar
- MsgBox "Look at the title bar" ' tell user to examine the change
- SetWindowText hwnd, save$ ' set it back to original
- AppMinimize ' make WinWord iconic
- wmSetText = 12 ' WM_SETTEXT message
- For i = 0 To 100
- ' SendMessage wmSetText is equivalent to SetWindowText
- SendMessage hwnd, wmSetText, 0, "test #" + Str$(i)
- Next i
- AppRestore ' restore WinWord from iconic state
- SetWindowText hwnd, save$ ' restore title bar to original
- End Sub